package com.w7vm.menuweb.service;

import java.util.ArrayList;
import java.util.List;

import com.w7vm.menuweb.entity.CardapioBuffetWeb;
import com.w7vm.menuweb.entity.CardapioEspecialidadeWeb;
import com.w7vm.menuweb.entity.CardapioInfantilWeb;
import com.w7vm.menuweb.entity.CardapioLaCarteWeb;
import com.w7vm.menuweb.entity.CardapioSelfServiceWeb;
import com.w7vm.menuweb.utility.Constantes;
import com.w7vm.menuweb.vo.CardapioVO;

public class CardapioService {
	
	Constantes constObj = new Constantes();
	
	
	public CardapioVO convertCardapioBuffetEntityToVO(CardapioBuffetWeb cardapioBuffetEntity) {
		System.out.println("convertCardapioBuffetEntityToVO................");
		CardapioVO buffetVO = new CardapioVO();

		buffetVO.setIdCardapioBuffetWeb(cardapioBuffetEntity.getIdCardapioBuffetWeb());
		buffetVO.setEntradasQuentes(cardapioBuffetEntity.getEntradasQuentes());
		buffetVO.setNomePrato(cardapioBuffetEntity.getNomeBuffet());
		buffetVO.setDiasSemana(cardapioBuffetEntity.getDiasSemana());
		buffetVO.setSobremesa(cardapioBuffetEntity.getSobremesa());
		buffetVO.setCortesia(cardapioBuffetEntity.getCortesia());
		buffetVO.setDtInicio(cardapioBuffetEntity.getDtInicio());
		buffetVO.setDtTermino(cardapioBuffetEntity.getDtTermino());
		buffetVO.setCategoriaCardapio(constObj.CARDAPIO_BUFFET);
		return buffetVO;
	}

	
	public List<CardapioVO> convertCardapioBuffetEntity(List<CardapioBuffetWeb> cardapioBuffetL) {

		System.out.println("convertCardapioBuffetEntity................"+ cardapioBuffetL.size());

		List<CardapioVO> cardapioL = new ArrayList<CardapioVO>();
		
		for(CardapioBuffetWeb b : cardapioBuffetL){
			CardapioVO c = new CardapioVO();
			c.setEntradasFrias(b.getEntradasFrias());
			c.setIdCardapioBuffetWeb(b.getIdCardapioBuffetWeb());
			c.setEntradasQuentes(b.getEntradasQuentes());
			c.setNomePrato(b.getNomeBuffet());
			c.setDiasSemana(b.getDiasSemana());
			c.setSobremesa(b.getSobremesa());
			c.setCortesia(b.getCortesia());
			c.setDtInicio(b.getDtInicio());
			c.setDtTermino(b.getDtTermino());
			c.setCategoriaCardapio(constObj.CARDAPIO_BUFFET);
			c.setImgCardapio("../../../../resources/icones/cardapio/cardBuffet.ico");
			cardapioL.add(c);
		}
		System.out.println("convertCardapioBuffetEntity................"+ cardapioL.size());
		return cardapioL;
	}
	
	public CardapioVO convertCardapioSelfServiceEntityToVO(CardapioSelfServiceWeb cardapioSelfServiceEntity) {
		System.out.println("convertCardapioSelfServiceEntityToVO................");
		CardapioVO selfserviceVO = new CardapioVO();

		selfserviceVO.setIdCardapioSelfServiceWeb(cardapioSelfServiceEntity.getIdCardapioSelfServiceWeb());
		selfserviceVO.setEntradasQuentes(cardapioSelfServiceEntity.getEntradasQuentes());
		selfserviceVO.setNomePrato(cardapioSelfServiceEntity.getNomeSelfService());
		selfserviceVO.setDiasSemana(cardapioSelfServiceEntity.getDiasSemana());
		selfserviceVO.setSobremesa(cardapioSelfServiceEntity.getSobremesa());
		selfserviceVO.setCortesia(cardapioSelfServiceEntity.getCortesia());
		selfserviceVO.setDtInicio(cardapioSelfServiceEntity.getDtInicio());
		selfserviceVO.setDtTermino(cardapioSelfServiceEntity.getDtTermino());
		selfserviceVO.setCategoriaCardapio(constObj.CARDAPIO_BUFFET);
		return selfserviceVO;
	}

	
	public List<CardapioVO> convertCardapioSelfServiceEntity(List<CardapioSelfServiceWeb> cardapioSelfServiceL) {
		List<CardapioVO> cardapioL = new ArrayList<CardapioVO>();
		
		for(CardapioSelfServiceWeb s : cardapioSelfServiceL){
			CardapioVO c = new CardapioVO();
			c.setIdCardapioSelfServiceWeb(s.getIdCardapioSelfServiceWeb());
			c.setEntradasFrias(s.getEntradasFrias());
			c.setNomePrato(s.getNomeSelfService());
			c.setEntradasQuentes(s.getEntradasQuentes());
			c.setDiasSemana(s.getDiasSemana());
			c.setSobremesa(s.getSobremesa());
			c.setCortesia(s.getCortesia());
			c.setDtInicio(s.getDtInicio());
			c.setCategoriaCardapio(constObj.CARDAPIO_SELFSERVICE);
			c.setImgCardapio("../../../../resources/icones/cardapio/cardSelfService.ico");
			c.setDtTermino(s.getDtTermino());
			cardapioL.add(c);
		}
		return cardapioL;
	}
	
	public List<CardapioVO> convertCardapioInfantilEntity(List<CardapioInfantilWeb> cardapioInfantilL) {
		
		List<CardapioVO> cardapioL = new ArrayList<CardapioVO>();
		
		for(CardapioInfantilWeb b : cardapioInfantilL){
			CardapioVO c = new CardapioVO();
			c.setIdCardapioInfantilWeb(b.getIdCardapioInfantilWeb());
			c.setEntradasFrias(b.getEntradasFrias());
			c.setEntradasQuentes(b.getEntradasQuentes());
			c.setDiasSemana(b.getDiasSemana());
			c.setSobremesa(b.getSobremesa());
			c.setCouvert(b.getCouvert());
			c.setDtInicio(b.getDtInicio());
			c.setDtTermino(b.getDtTermino());
			c.setNomePrato(b.getNomePrato());
			c.setCategoriaCardapio(constObj.CARDAPIO_INFANTIL);
			c.setImgCardapio("../../../../resources/icones/cardapio/cardInfantil.ico");
			c.setTipoCardapio(b.getPratoSy().getDescricao());
			cardapioL.add(c);
		}
		return cardapioL;
	}
	
	public List<CardapioVO> convertCardapioLaCarteEntity(List<CardapioLaCarteWeb> cardapioLaCarteL) {
		
		List<CardapioVO> cardapioL = new ArrayList<CardapioVO>();
		
		for(CardapioLaCarteWeb b : cardapioLaCarteL){
			CardapioVO c = new CardapioVO();
			c.setIdCardapioLaCarteWeb(b.getIdCardapioLaCarteWeb());
			c.setEntradasFrias(b.getEntradasFrias());
			c.setEntradasQuentes(b.getEntradasQuentes());
			c.setDiasSemana(b.getDiasSemana());
			c.setSobremesa(b.getSobremesa());
			c.setCouvert(b.getCouvert());
			c.setDtInicio(b.getDtInicio());
			c.setDtTermino(b.getDtTermino());
			c.setNomePrato(b.getNomePrato());
			c.setCategoriaCardapio(constObj.CARDAPIO_LACARTE);
			c.setImgCardapio("../../../../resources/icones/cardapio/cardLaCarte.ico");
			c.setTipoCardapio(b.getPratoSy().getDescricao());
			cardapioL.add(c);
		}
		return cardapioL;
	}
	
	
	public List<CardapioVO> convertCardapioEspecialidadeEntity(List<CardapioEspecialidadeWeb> cardapioEspecialidadeL) {
		
		List<CardapioVO> cardapioL = new ArrayList<CardapioVO>();
		
		for(CardapioEspecialidadeWeb b : cardapioEspecialidadeL){
			CardapioVO c = new CardapioVO();
			c.setIdCardapioEspecialidadeWeb(b.getIdCardapioEspecialidadeWeb());
			c.setDescricao(b.getDescricao());
			c.setDiasSemana(b.getDiasSemana());
			c.setAcompanhamento(b.getAcompanhamento());
			c.setDtInicio(b.getDtInicio());
			c.setDtTermino(b.getDtTermino());
			c.setNomePrato(b.getNomePrato());
			c.setNomeEspecialidade(b.getEspecialidade());
			if(b.getEspecialidade().equals(constObj.CARDAPIO_LANCHE)){
				c.setCategoriaCardapio(constObj.CARDAPIO_LANCHE);
				c.setImgCardapio("../../../../resources/icones/cardapio/cardLanche.ico");
			}
			else if(b.getEspecialidade().equals(constObj.CARDAPIO_PETISCO)){
				c.setCategoriaCardapio(constObj.CARDAPIO_PETISCO);
				c.setImgCardapio("../../../../resources/icones/cardapio/cardPetisco.ico");
			}
			else if(b.getEspecialidade().equals(constObj.CARDAPIO_PIZZA)){
				c.setCategoriaCardapio(constObj.CARDAPIO_PIZZA);
				c.setImgCardapio("../../../../resources/icones/cardapio/cardPizza.ico");
			}
			else if(b.getEspecialidade().equals(constObj.CARDAPIO_SALGADO)){
				c.setCategoriaCardapio(constObj.CARDAPIO_SALGADO);
				c.setImgCardapio("../../../../resources/icones/cardapio/cardSalgado.ico");
			}
			else if(b.getEspecialidade().equals(constObj.CARDAPIO_SOBREMESA)){
				c.setCategoriaCardapio(constObj.CARDAPIO_SOBREMESA);
				c.setImgCardapio("../../../../resources/icones/cardapio/cardDoce.ico");
			}


			cardapioL.add(c);
		}
		return cardapioL;
	}




}
